package com.mtk.launcher.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.mtk.launcher.R;

public class TimeCardView extends LinearLayout {
    public TimeCardView(Context context) {
        this(context, null);
    }

    public TimeCardView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    ImageView iv_time_up, iv_time_down;

    public TimeCardView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        View view = View.inflate(context, R.layout.view_time_text_card, null);
        iv_time_up = view.findViewById(R.id.iv_time_up);
        iv_time_down = view.findViewById(R.id.iv_time_down);
        addView(view);
    }

    public void showCurrentNum(String showText) {
        switch (showText) {
            case "0":
                iv_time_up.setImageResource(R.mipmap.number_00);
                iv_time_down.setImageResource(R.mipmap.number_01);
                break;
            case "1":
                iv_time_up.setImageResource(R.mipmap.number_10);
                iv_time_down.setImageResource(R.mipmap.number_11);
                break;
            case "2":
                iv_time_up.setImageResource(R.mipmap.number_20);
                iv_time_down.setImageResource(R.mipmap.number_21);
                break;
            case "3":
                iv_time_up.setImageResource(R.mipmap.number_30);
                iv_time_down.setImageResource(R.mipmap.number_31);
                break;
            case "4":
                iv_time_up.setImageResource(R.mipmap.number_40);
                iv_time_down.setImageResource(R.mipmap.number_41);
                break;
            case "5":
                iv_time_up.setImageResource(R.mipmap.number_50);
                iv_time_down.setImageResource(R.mipmap.number_51);
                break;
            case "6":
                iv_time_up.setImageResource(R.mipmap.number_60);
                iv_time_down.setImageResource(R.mipmap.number_61);
                break;
            case "7":
                iv_time_up.setImageResource(R.mipmap.number_70);
                iv_time_down.setImageResource(R.mipmap.number_71);
                break;
            case "8":
                iv_time_up.setImageResource(R.mipmap.number_80);
                iv_time_down.setImageResource(R.mipmap.number_81);
                break;
            case "9":
                iv_time_up.setImageResource(R.mipmap.number_90);
                iv_time_down.setImageResource(R.mipmap.number_91);
                break;
        }
    }

}
